NAME
     grep - search a file for a pattern

SYNTAX
     grep [ option ] ...  [ expression ] [ file ] ...

DESCRIPTION
     Grep searches the input files (standard input default) for lines 
     matching a pattern.  Normally, each line found is copied to the 
     standard output.  Grep patterns are regular expressions.  The 
     following options are recognized.

     -v   All lines but those matching are printed.

     -c   Only a count of matching lines is printed.

     -l   The names of files with matching lines are listed
          (once) separated by newlines.

     -n   Each line is preceded by its relative line number in
          the file.

     -i   The case of letters is ignored in making comparisons.
     -y   That is, upper and lower case are considered identical.

     -s   Silent mode.  Nothing is printed (except error messages).
          This is useful for checking the error status (see DIAGNOSTICS).

     -h   Filename heading is omitted on each output line.  The default
          case is that the file name is shown if there is more than
          one input file. 

     -e expression
          Same as a simple expression argument, but useful when
          the expression begins with a -.

     -f file
          The regular expression is taken from the file.

     Grep accepts regular expressions.  In the following description 
     'character' excludes newline.  The regular expressions are as follows:

	^          Matches the beginning of the line.

   	$          Matches the end of the line.

  	\          Matches the following character as follows:
                        \b  =   Backspace
                        \n  =   Linefeed
                        \r  =   Carriage return
                        \s  =   Space
                        \t  =   tab
			\nnn =  octal number for character
                        \(any other character)  =   the character

	.          Matches any character.

  	Character  Matches that character

	[ and ]    Encloses a string that specifies a character class.
 	           Any character in the brackets [] will be matched, as
	           well as a range, such as 'a-z', in the brackets [] will
	           be matched.  Also the compliment of the character class
                   can be given with the string proceeded by the character ^.

 	*          Matches the preceding expression zero or more times.

 	: (colon)  OR logic operator between two expressions.

	&          AND logic operator between two expressions.

	!          NOT logic operator of an expression.

	( ... )    Parentheses allow expressions to be groupd.

        The OR and AND operators have the same precedence and are lower than
        the NOT operator.  The logic operators are parsed left to right.
        If the expression is read from a file (-f option), then each line 
        of input is considered to be separated by the OR logic operator.

EXAMPLES:
	1.  Search for the word "main" in the files day1, day2, day3.

  	                        grep main day?

	2.  Search for the words "main" or "art" in the file day1.  Use the
            option -n to print the line numbers too.  Also the case independent
            option (-i) is choosen.

 	                    grep -ni 'main:art' day1

	3.  Search for any word beginning with "art" in the file day1.  Here
            the notation [a-z]* means that any series of letters from a to z
            will be matched.  So words like "art", "artfull", "artist", 
            "artie" will be found.

                  grep '^art[a-z]*[\s\t\n]:[\s\t]art[a-z]*[\s\t\n]' day1

DIAGNOSTICS
     Exit status is 0 if any matches are found, 1 if none, 2 for
     syntax errors or inaccessible files.

RESTRICTIONS
     Care should be taken when using the character * in the expression as 
     it can be expanded for filenames, and the character $ as it can be 
     expanded for environment parameters.  It is safest to enclose the entire
     expression argument in single quotes '... '.  
